package com.matrix.java.chap_04;

import java.util.Scanner;

/*
    几何：正多边形的面枳
 */
public class Ex4_05 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter the number of sides: ");
        double n = input.nextDouble();
        System.out.print("Enter the side: ");
        double s = input.nextDouble();
        double area = (n * s * s) / (4 * Math.tan(Math.PI / n));
        System.out.println("The area of the polygon is " + area);
        input.close();
    }
}
